package com.study._1_linked_lister;

public class _206 {
    public static void main(String[] args) {

    }

    public ListNode reverseList(ListNode head) {

        if (head == null) {
            return null;
        }

        ListNode before = null;

        ListNode next;

        while (head != null) {
            next = head.next;
            head.next = before;
            before = head;
            head = next;
        }
        return before;

    }
}
